import 'book_result_entity.dart';

class AppBookModel {
  int iId;
  int num;
  int tPage;
  String cover;
  String title;
  String customTitle;
  String times;
  String bookdesc;
  String authorname;

  AppBookModel(
      {this.iId,
        this.num,
        this.tPage,
        this.cover,
        this.title,
        this.customTitle,
        this.times,
        this.bookdesc,
        this.authorname});

  AppBookModel.fromModel(AlbumBriefDetailInfos info) {
    iId = info.id;
    num = 1;
    tPage = 1;
    cover = info.albumInfo.cover;
    title = info.albumInfo.title;
    customTitle = info.albumInfo.customTitle;
    times = "0:0";
    authorname=info.anchorInfo.nickname;
    bookdesc=info.albumInfo.shortIntro;
  }

  AppBookModel.fromJson(Map<String, dynamic> json) {
    iId = json['_id'];
    num = json['num'];
    tPage = json['t_page'];
    cover = json['cover'];
    title = json['title'];
    customTitle = json['customTitle'];
    times = json['times'];
    bookdesc = json['bookdesc'];
    authorname = json['authorname'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['_id'] = this.iId;
    data['num'] = this.num;
    data['t_page'] = this.tPage;
    data['cover'] = this.cover;
    data['title'] = this.title;
    data['customTitle'] = this.customTitle;
    data['times'] = this.times;
    data['bookdesc'] = this.bookdesc;
    data['authorname'] = this.authorname;
    return data;
  }
}